package Day008_List_Collections_set.Demo02_ArrayList集合;

import java.util.ArrayList;

public class ArrayList集合遍历 {
    public static void main(String[] args) {
        //1.创建集合
        ArrayList<String> list = new ArrayList<>();
        //2.添加数据 add
        list.add("迪丽热巴"); //0
        list.add("古力娜扎"); //1
        list.add("马尔扎哈"); //2
        list.add("泷泽萝拉"); //3
        //3.遍历数据 set
        System.out.println(list.get(0));
        System.out.println(list.get(1));
        System.out.println(list.get(2));
        System.out.println(list.get(3));

        for (int i = 0;i < list.size();i++){

            System.out.print(list.get(i) + " ");
        }

    }
}
